//
// Created by xuchao on 16-11-21.
//

#include "OkPgResultSet.h"

using namespace OKPg;

OKPg::OkPgResultSet::~OkPgResultSet() {

}

OkPgResultSet::OkPgResultSet(PGresult *result) : hasError_(false),
                                                 errMsg_(K_EMPTY_STR),
                                                 dataTable_(result),
                                                 resultInt_(-1) {

}

OkPgResultSet::OkPgResultSet(const std::string &errMsg) : hasError_(true),
                                                          errMsg_(errMsg),
                                                          dataTable_(nullptr),
                                                          resultInt_(K_NULL_INT) {

}

OkPgResultSet::OkPgResultSet(const int resultInt) : hasError_(resultInt < 0 ? true : false),
                                                    errMsg_(K_EMPTY_STR),
                                                    dataTable_(nullptr),
                                                    resultInt_(resultInt) {
}

const bool OkPgResultSet::hasError() {
    return hasError_;
}

const std::string OkPgResultSet::errMsg() {
    return errMsg_;
}


const DataTable OkPgResultSet::resultDatatable() {
    return dataTable_;
}

const int OkPgResultSet::resultInt() {
    return resultInt_;
}




